package com.coollang.smartbra.adapter;

import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.coollang.smartbra.R;
import com.coollang.smartbra.beans.FragmentSportItem;

import java.util.List;

/**
 * @author : Timmy
 */
public class FragmentSportAdapter extends BaseQuickAdapter<FragmentSportItem, BaseViewHolder> {
    public FragmentSportAdapter(@Nullable List<FragmentSportItem> data) {
        super(R.layout.fragment_sport_item, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, FragmentSportItem item) {
        holder.setImageResource(R.id.iv_image, item.getImageId())
                .setText(R.id.tv_title, item.getSportName());

        View view = holder.getView(R.id.view_right);
        if (holder.getAdapterPosition() % 2 != 0) {
            view.setVisibility(View.GONE);
        } else {
            view.setVisibility(View.VISIBLE);
        }

    }
}
